#include <bits/stdc++.h>
using namespace std;
int b[100005];
long long qzh[100005];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
        int a;cin>>a;
        ++b[a];
    }
    int start=-1;
    for(int i=1; i<=100000; i++){
        if(b[i]!=0&&start==-1) start=i;
        if(start==-1||start==i||b[i]==0) continue;
        if(b[start]<=b[i]) b[start]=0,start=i;
        else if(b[start]>b[i]) b[start]-=b[i];
    }
    long long minn=0;
    for(int i=1; i<=100000; i++) minn+=b[i];
    int xb=0;
    for(int i=1; i<=100000; i++){
        if(b[i]==0) continue;
        qzh[xb+1]=qzh[xb]+b[i];
        xb++;
    }
    for(int i=xb; i>=2; i--){
        if(qzh[xb]-qzh[i-1]>qzh[i-1]){
            minn=min(qzh[xb]-qzh[i-1],minn);
            break;
        }
    }
    cout<<minn;
    return 0;
}
